package com.guoyh.bilui.tab.titleview

import android.content.Context
import android.widget.LinearLayout
import com.guoyh.baseutils.mylog.Loger
import com.guoyh.mvvmwanandroid.weight.viewpager.CustmSelTitleView
import com.guoyh.baseutils.ext.dp2px
import net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.IMeasurablePagerTitleView

class CustomSelViewGroup(val titleView: CustmSelTitleView, context: Context) :LinearLayout(context),
    IMeasurablePagerTitleView {

    init {
        val params  = LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.MATCH_PARENT)
        params.setMargins(dp2px(10), 0, dp2px(10), 0)
        addView(titleView,params)
        Loger.dd("=======")
    }

    override fun onDeselected(index: Int, totalCount: Int) {
        titleView.onDeselected(index,totalCount)
    }

    override fun onSelected(index: Int, totalCount: Int) {
        titleView.onSelected(index,totalCount)

    }

    override fun onLeave(index: Int, totalCount: Int, leavePercent: Float, leftToRight: Boolean) {
        titleView.onLeave(index,totalCount,leavePercent, leftToRight)

    }

    override fun onEnter(index: Int, totalCount: Int, enterPercent: Float, leftToRight: Boolean) {
        titleView.onEnter(index,totalCount,enterPercent, leftToRight)

    }

    override fun getContentLeft(): Int {
        return  titleView.getContentLeft()
    }

    override fun getContentTop(): Int {
      return titleView.getContentTop()
    }

    override fun getContentRight(): Int {
        return titleView.getContentRight()
    }

    override fun getContentBottom(): Int {
       return titleView.getContentBottom()
    }


}